<template>
    <div>
        <el-row style="margin-top: 20px">
            <el-col :span="2">
                <el-button type="primary" @click="checkAddBt" size="medium">
                    新增
                </el-button>
            </el-col>
            <el-col :span="2">
                <el-button type="primary" @click="checkCombineBt" size="medium">
                    合并
                </el-button>
            </el-col>
            <el-col :span="4" :offset="13" align="right">
                <el-input
                        style="width: 150px"
                        size="medium"
                        clearable
                        v-model="searchTel"
                        placeholder="请输入手机号码">

                </el-input>
            </el-col>
            <el-col :span="3" align="right">
                <el-button type="primary" size="medium" icon="el-icon-search" @click="firstSearch">
                    搜索
                </el-button>
            </el-col>
        </el-row>
        <el-row style="margin-top: 20px; min-height: 330px">
            <el-col>
                <el-table
                        :cell-style="this.$store.state.cellCssObj"
                        :header-cell-style="this.$store.state.headerCssObj"
                        @cell-click="cellClick"
                        :row-class-name="rowClassName"
                        border
                        :data="pageData">
                    <el-table-column
                            align="center"
                            prop="name"
                            label="用户名">
                    </el-table-column>
                    <el-table-column
                            align="center"
                            prop="money"
                            label="余额">
                    </el-table-column>
                    <el-table-column
                            align="center"
                            prop="tel"
                            label="电话号码">
                    </el-table-column>
                    <el-table-column
                            align="center"
                            prop="score"
                            label="积分">
                    </el-table-column>
                    <el-table-column
                            align="center"
                            prop="discount"
                            label="折扣">
                    </el-table-column>
                    <el-table-column
                            align="center"
                            prop="state"
                            label="状态">
                    </el-table-column>
                    <el-table-column
                            align="center"
                            min-width="150px"
                            label="操作">
                        <el-button type="primary" @click="fixDialogVisible = true"
                                   size="mini">
                            修改
                        </el-button>
                        <el-button type="primary" @click="checkAddMoneyBt"
                                   size="mini">
                            充值
                        </el-button>
                        <el-button type="danger" @click="myDeleteDialogVisible=true"
                                   size="mini">
                            删除
                        </el-button>
                    </el-table-column>

                </el-table>

            </el-col>

        </el-row>
        <el-row style="margin-top: 20px">
            <el-col align="center">
                <paging :obj="pagingData"></paging>
            </el-col>
        </el-row>

        <el-dialog
                title="新增会员"
                :visible.sync="addDialogVisible"
                width="30%"
                :close-on-click-modal='false'
                center="">
            <el-row type="flex" align="middle">
                <el-col :span="10" align="right">
                    <label for="addName">会员名：</label>
                </el-col>
                <el-col :span="12">
                    <el-input
                            id="addName"
                            style="width: 150px"
                            size="medium"
                            clearable
                            v-model="addName"
                            placeholder="请输入会员名">

                    </el-input>
                </el-col>
            </el-row>
            <el-row type="flex" align="middle" style="margin-top: 20px">
                <el-col :span="10" align="right">
                    <label for="addMoney">充值金额：</label>
                </el-col>
                <el-col :span="12">
                    <el-input
                            id="addMoney"
                            style="width: 150px"
                            size="medium"
                            clearable
                            v-model="addMoney"
                            placeholder="请输入金额">

                    </el-input>
                </el-col>
            </el-row>
            <el-row type="flex" align="middle" style="margin-top: 20px">
                <el-col :span="10" align="right">
                    <label for="addTel">电话号码：</label>
                </el-col>
                <el-col :span="12">
                    <el-input
                            id="addTel"
                            style="width: 150px"
                            size="medium"
                            v-model="addTel"
                            clearable
                            placeholder="请输入电话号码">

                    </el-input>
                </el-col>
            </el-row>
            <span slot="footer" class="dialog-footer">
    <el-button @click="addDialogVisible = false" size="medium">取 消</el-button>
    <el-button type="primary" @click="addMemberCommit" size="medium">确 定</el-button>
  </span>
        </el-dialog>


        <el-dialog
                title="修改会员信息"
                :visible.sync="fixDialogVisible"
                :close-on-click-modal='false'
                width="30%"
                center="">
            <el-row type="flex" align="middle">
                <el-col :span="10" align="right">
                    <label for="fixName">会员名：</label>
                </el-col>
                <el-col :span="12">
                    <el-input
                            id="fixName"
                            style="width: 150px"
                            size="medium"
                            v-model="fixName"
                            clearable
                            placeholder="请输入会员名">

                    </el-input>
                </el-col>
            </el-row>
            <el-row type="flex" align="middle" style="margin-top: 20px">
                <el-col :span="10" align="right">
                    <label for="number">会员卡号：</label>
                </el-col>
                <el-col :span="12">
                    <el-input
                            id="number"
                            disabled=""
                            style="width: 150px"
                            size="medium"
                            v-model="number"
                            placeholder="卡号">

                    </el-input>
                </el-col>
            </el-row>
            <el-row type="flex" align="middle" style="margin-top: 20px">
                <el-col :span="10" align="right">
                    <label for="fixScore">会员积分：</label>
                </el-col>
                <el-col :span="12">
                    <el-input
                            id="fixScore"
                            style="width: 150px"
                            size="medium"
                            clearable
                            v-model="fixScore"
                            placeholder="积分">

                    </el-input>
                </el-col>
            </el-row>
            <el-row type="flex" align="middle" style="margin-top: 20px">
                <el-col :span="10" align="right">
                    <label for="fixTel">电话：</label>

                </el-col>
                <el-col :span="12">
                    <el-input
                            id="fixTel"
                            style="width: 150px"
                            size="medium"
                            v-model="fixTel"
                            clearable
                            placeholder="电话号码">

                    </el-input>
                </el-col>
            </el-row>
            <el-row type="flex" align="middle" style="margin-top: 20px">
                <el-col :span="10" align="right">
                    <label for="fixIdCard">身份证号：</label>

                </el-col>
                <el-col :span="12">
                    <el-input
                            id="fixIdCard"
                            style="width: 150px"
                            size="medium"
                            clearable
                            v-model="fixIdCard"
                            placeholder="身份证号">

                    </el-input>
                </el-col>
            </el-row>
            <el-row type="flex" align="middle" style="margin-top: 20px">
                <el-col :span="10" align="right">
                    <label for="fixStateSelect">状态：</label>
                </el-col>
                <el-col :span="12">
                    <diySelect id="fixStateSelect" :optionData="menberStateData" size="medium"
                               :propsValue="stateSelect"
                               @choose="chooseState"></diySelect>
                </el-col>
            </el-row>
            <span slot="footer" class="dialog-footer">
    <el-button @click="fixDialogVisible = false" size="medium">取 消</el-button>
    <el-button type="primary" @click="fixMemberCommit" size="medium">确 定</el-button>
  </span>
        </el-dialog>
        <el-dialog
                title="会员充值"
                :visible.sync="addMoneyDialogVisible"
                width="30%"
                :close-on-click-modal='false'
                center="">
            <el-row type="flex" align="middle">
                <el-col :span="10" align="right">
                    <label>会员名：</label>
                </el-col>
                <el-col :span="12">
                    <el-input
                            disabled=""
                            style="width: 150px"
                            size="medium"
                            clearable
                            v-model="fixName"
                            placeholder="会员名">

                    </el-input>
                </el-col>
            </el-row>
            <el-row type="flex" align="middle" style="margin-top: 20px">
                <el-col :span="10" align="right">
                    <label>会员卡号：</label>
                </el-col>
                <el-col :span="12">
                    <el-input
                            disabled=""
                            style="width: 150px"
                            size="medium"
                            v-model="number"
                            placeholder="卡号">

                    </el-input>
                </el-col>
            </el-row>
            <el-row type="flex" align="middle" style="margin-top: 20px">
                <el-col :span="10" align="right">
                    <label>会员积分：</label>
                </el-col>
                <el-col :span="12">
                    <el-input
                            disabled=""
                            style="width: 150px"
                            size="medium"
                            v-model="fixScore"
                            clearable
                            placeholder="积分">

                    </el-input>
                </el-col>
            </el-row>
            <el-row type="flex" align="middle" style="margin-top: 20px">
                <el-col :span="10" align="right">
                    <label>电话：</label>

                </el-col>
                <el-col :span="12">
                    <el-input
                            disabled=""
                            style="width: 150px"
                            size="medium"
                            v-model="fixTel"
                            clearable
                            placeholder="电话号码">

                    </el-input>
                </el-col>
            </el-row>
            <el-row type="flex" align="middle" style="margin-top: 20px">
                <el-col :span="10" align="right">
                    <label>身份证号：</label>

                </el-col>
                <el-col :span="12">
                    <el-input
                            disabled=""
                            style="width: 150px"
                            size="medium"
                            v-model="fixIdCard"
                            clearable
                            placeholder="身份证号">

                    </el-input>
                </el-col>
            </el-row>
            <el-row type="flex" align="middle" style="margin-top: 20px">
                <el-col :span="10" align="right">
                    <label for="addMoneyNum">充值金额：</label>
                </el-col>
                <el-col :span="12">
                    <el-input
                            id="addMoneyNum"
                            style="width: 150px"
                            size="medium"
                            clearable
                            v-model="addMoneyNum"
                            placeholder="请输入金额">

                    </el-input>
                </el-col>
            </el-row>
            <span slot="footer" class="dialog-footer">
    <el-button @click="addMoneyDialogVisible = false" size="medium">取 消</el-button>
    <el-button type="primary" @click="addMoneyCommit" size="medium">确 定</el-button>
  </span>
        </el-dialog>
        <el-dialog
                title=""
                :visible.sync="enterCombineDialogVisible"
                width="20%"
                center="">
            <el-row type="flex" align="middle">
                <el-col align="center" style="font-size: 16px">
                    <span>确认合并？</span>
                </el-col>
            </el-row>
            <span slot="footer" class="dialog-footer">
    <el-button @click="enterCombineDialogVisible = false" size="medium">取 消</el-button>
    <el-button type="primary" @click="combineCommit" size="medium">确 定</el-button>
  </span>
        </el-dialog>
        <el-dialog
                top="60px"
                title="会员卡合并"
                :close-on-click-modal='false'
                :visible.sync="combineDialogVisible"
                width="80%"
                center="">
            <el-row type="flex" align="middle">
                <el-col :span="4">
                    <el-input
                            style="width: 150px"
                            size="medium"
                            v-model="oneTel"
                            clearable
                            placeholder="请输入主卡电话">

                    </el-input>

                </el-col>
                <el-col :span="3">
                    <el-button
                            @click="combineSearchPageone"
                            icon="el-icon-search"
                            size="medium"
                            type="primary">
                        搜索
                    </el-button>
                </el-col>
                <el-col :span="17" align="right">
                    <span>说明：所有信息将会合并到主卡，唯一信息将取主卡信息</span>
                </el-col>
            </el-row>

            <el-row style="margin-top: 20px">
                <el-col>
                    <el-table
                            border
                            :cell-style="this.$store.state.cellCssObj"
                            :header-cell-style="this.$store.state.headerCssObj"
                            :data="oneNumberData">
                        <el-table-column
                                align="center"
                                prop="name"
                                label="用户名">
                        </el-table-column>
                        <el-table-column
                                align="center"
                                prop="money"
                                label="余额">
                        </el-table-column>
                        <el-table-column
                                align="center"
                                prop="tel"
                                label="电话号码">
                        </el-table-column>
                        <el-table-column
                                align="center"
                                prop="score"
                                label="积分">
                        </el-table-column>
                        <el-table-column
                                align="center"
                                prop="discount"
                                label="折扣">
                        </el-table-column>
                        <el-table-column
                                align="center"
                                prop="state"
                                label="状态">
                        </el-table-column>
                    </el-table>
                </el-col>
            </el-row>
            <el-row style="margin-top: 20px">
                <el-col :span="4">
                    <el-input
                            style="width: 150px"
                            size="medium"
                            v-model="twoTel"
                            clearable
                            placeholder="请输入副卡电话">

                    </el-input>

                </el-col>
                <el-col :span="3">
                    <el-button
                            @click="combineSearchPagetwo"
                            icon="el-icon-search"
                            size="medium"
                            type="primary">
                        搜索
                    </el-button>
                </el-col>
            </el-row>

            <el-row style="margin-top: 20px">
                <el-col>
                    <el-table
                            border
                            :cell-style="this.$store.state.cellCssObj"
                            :header-cell-style="this.$store.state.headerCssObj"
                            :data="twoNumberData">
                        <el-table-column
                                align="center"
                                prop="name"
                                label="用户名">
                        </el-table-column>
                        <el-table-column
                                align="center"
                                prop="money"
                                label="余额">
                        </el-table-column>
                        <el-table-column
                                align="center"
                                prop="tel"
                                label="电话号码">
                        </el-table-column>
                        <el-table-column
                                align="center"
                                prop="score"
                                label="积分">
                        </el-table-column>
                        <el-table-column
                                align="center"
                                prop="discount"
                                label="折扣">
                        </el-table-column>
                        <el-table-column
                                align="center"
                                prop="state"
                                label="状态">
                        </el-table-column>
                    </el-table>
                </el-col>
            </el-row>
            <span slot="footer" class="dialog-footer">
    <el-button @click="combineDialogVisible = false" size="medium">取 消</el-button>
    <el-button type="primary" @click="verifyEnterCombine" size="medium">确 定</el-button>
  </span>
        </el-dialog>
        <deleteDialog :deleteDialogVisible="myDeleteDialogVisible" @handleFun="deleteMemberCommit"
                      @cancel="myDeleteDialogVisible=false"></deleteDialog>
    </div>
</template>

<script>
    import {mapActions} from 'vuex'

    export default {
        name: "restaurantMemberPage",
        computed: {
            pagingData() {
                var that = this;
                return {
                    pageSize: 5,//一页展示几条数据
                    pagerCount: 5, //超过多少页打点省略
                    pageCount: that.pageCount,     //一共多少页
                    currentChange(num) {
                        that.currentPage = num//改变当前页
                        // console.log(that.currentPage);
                        if (that.pageType) {
                            that.searchPage()
                        } else {
                            that.pageSelect();
                        }
                    },

                }
            },
            // fixIdCard: {
            //     get:function(){
            //         return this.oldPageData[this.checkedRowIndex].idCard
            //         // if (this.oldPageData.length !== 0) {
            //         //
            //         //     return this.oldPageData[this.checkedRowIndex].idCard
            //         // } else {
            //         //     return null
            //         // }
            //     },
            //     set:function (val) {
            //         this.oldPageData[this.checkedRowIndex].idCard=val
            //     }
            //
            //
            // },

            // fixTel: {
            //     get:function(){
            //         return this.oldPageData[this.checkedRowIndex].tel
            //         // if (this.oldPageData.length !== 0) {
            //         //     return this.oldPageData[this.checkedRowIndex].tel
            //         // } else {
            //         //     return null
            //         // }
            //     },
            //     set:function (val) {
            //         this.oldPageData[this.checkedRowIndex].tel=val
            //     }
            //
            // },

            // fixScore: {
            //     get: function () {
            //         if (this.oldPageData.length !== 0) {
            //             return this.oldPageData[this.checkedRowIndex].score
            //         } else {
            //             return null
            //         }
            //
            //     }, set: function (val) {
            //         this.oldPageData[this.checkedRowIndex].score = val
            //     }
            // },

            // fixName: {
            //     get:function(){
            //         return this.oldPageData[this.checkedRowIndex].name
            //         // if (this.oldPageData.length !== 0) {
            //         //
            //         //     return this.oldPageData[this.checkedRowIndex].name
            //         // } else {
            //         //     return null
            //         // }
            //     },
            //     set:function (val) {
            //         this.oldPageData[this.checkedRowIndex].name=val
            //     }
            //
            //
            // },

            // number() {
            //     if (this.oldPageData.length !== 0) {
            //         return this.oldPageData[this.checkedRowIndex].number
            //     } else {
            //         return null
            //     }
            // },

            // stateSelect: {
            //     get: function () {
            //         return this.oldPageData[this.checkedRowIndex].state
            //     },
            //     set: function (val) {
            //         this.oldPageData[this.checkedRowIndex].state = val;
            //     }
            //
            // },

            // checkedRowIndex() {
            //     return this.$store.state.operationStore.checkedRowIndex
            // },

        },
        data() {
            return {
                stateSelect:0,
                number: '',
                fixScore: '',
                fixName: '',
                fixTel: '',
                fixIdCard: '',
                checkedRowIndex: 0,
                oldPageData: [{}],
                pageData: [],
                oneTel: '',
                twoTel: '',
                oneNumberData: [],//合并主卡
                twoNumberData: [],//合并副卡
                enterCombineDialogVisible: false,
                combineDialogVisible: false,
                addMoneyNum: '',
                addMoneyDialogVisible: false,
                myDeleteDialogVisible: false,
                menberStateData: [{value: 0, label: '正常'}, {value: 1, label: '冻结'}, {value: 2, label: '挂失'},],
                fixDialogVisible: false,
                addName: '',
                addTel: '',
                addMoney: '',
                addDialogVisible: false,
                searchTel: '',
                pageCount: 1,
                pageType: 0,
                currentPage: 1,
            }
        },
        created() {
            this.pageSelect();
        },
        methods: {
            ...mapActions(['invoPageSelectAct', 'getTime', 'userOperation', 'invoSearchPageAct', 'addMemberCommitAct', 'fixMemberCommitAct',
                'deleteMemberCommitAct', 'addMoneyCommitAct', 'combineCommitAct', 'setCheckedRowIndex']),
            /*发送日志*/
            operation(actTypeStr) {
                this.getTime(); //更新时间
                let obj = {
                        userName: this.$store.state.user.userName,
                        operationDate: this.$store.state.nowTime.time,
                        operationMessage: actTypeStr,
                    }
                ;
                this.userOperation(obj);
            },
            /*状态数据转换*/
            pageDataExchange(data) {
                let arr = []
                for (let item of data) {
                    if (item.state === 0) {
                        item.state = '正常'
                    } else if (item.state === 1) {
                        item.state = '冻结'
                    } else if (item.state === 2) {
                        item.state = '挂失'
                    }
                    arr.push(item)
                }
                return arr
            },
            /*分页查询会员信息*/
            pageSelect() {
                console.log(this.currentPage);
                console.log('pageSelect');
                let obj = {currentPage: this.currentPage, pageSize: 5}
                this.invoPageSelectAct(obj).then(resp => {
                    if (resp.Code === 200) {
                        console.log(resp);
                        this.pageCount = resp.PageCount
                        if (resp.MemberList.length > 0) {
                            this.oldPageData = JSON.parse(JSON.stringify(resp.MemberList))
                            console.log(this.oldPageData);
                            this.pageData = this.pageDataExchange(resp.MemberList);
                        } else if (this.currentPage > 1) {
                            this.currentPage--;
                            this.pageSelect()
                        } else {
                            this.pageData = [{}]           //空数据数据结构需要与前后文一致
                        }

                    }
                }).catch(err => {
                    console.log(err);
                })
            },
            /*分页条件查询*/
            searchPage() {
                console.log(this.currentPage);
                let obj = {currentPage: this.currentPage, pageSize: 5, searchName: this.searchTel}
                this.invoSearchPageAct(obj).then(resp => {
                    if (resp.Code === 200) {
                        console.log(resp.PageCount);
                        this.pageCount = resp.PageCount
                        if (resp.MemberList.length > 0) {
                            this.oldPageData = JSON.parse(JSON.stringify(resp.MemberList))
                            this.pageData = this.pageDataExchange(resp.MemberList);
                        } else if (this.currentPage > 1) {
                            this.currentPage--;
                            this.searchPage()
                        } else {
                            this.pageData = [{}]      //空数据数据结构需要与前后文一致
                        }

                    }
                }).catch(err => {
                    console.log(err);
                })
            },
            /*合并查询功能函数*/
            combineSearchPageone() {
                let obj = {currentPage: 1, pageSize: 5, searchName: this.oneTel}

                this.invoSearchPageAct(obj).then(resp => {
                    if (resp.Code === 200) {
                        this.oneNumberData = resp.MemberList
                        this.oneTel = ''

                    }
                }).catch(err => {
                    console.log(err);
                })
            },
            combineSearchPagetwo() {
                let obj = {currentPage: 1, pageSize: 5, searchName: this.twoTel}

                this.invoSearchPageAct(obj).then(resp => {
                    if (resp.Code === 200) {
                        this.twoNumberData = resp.MemberList
                        this.twoTel = ''

                    }
                }).catch(err => {
                    console.log(err);
                })
            },
            /*第一次查询*/
            firstSearch() {
                this.pageType = 1;
                this.currentPage = 1;
                this.searchTel ? this.searchPage() : this.pageSelect();

            },
            /*提交修改数据*/
            fixMemberCommit() {

                let obj = {
                    userId: this.pageData[this.checkedRowIndex].userId,
                    name: this.fixName,
                    number: this.number,
                    state: this.stateSelect,
                    score: this.fixScore,
                    tel: this.fixTel,
                    idCard: this.fixIdCard,
                }
                console.log(obj);
                this.fixMemberCommitAct(obj).then(resp => {
                    if (resp.Code === 200) {
                        this.operation("修改会员信息")  //发送日志
                        this.fixDialogVisible = false;
                        this.$message({
                            message: '修改成功',
                            type: 'success',
                            center: true,
                        });
                        if (this.pageType) {
                            this.searchPage();
                        } else {
                            this.pageSelect();
                        }

                    } else {
                        this.$message({
                            message: '修改失败',
                            center: true,
                        });
                    }
                }).catch(err => {
                    console.log(err);
                })
            },
            /*点击添加按钮*/
            checkAddBt() {
                /*清空添加输入框*/
                this.addName = '';
                this.addMoney = '';
                this.addTel = '';
                /*显示弹窗*/
                this.addDialogVisible = true;
            },
            /*提交添加数据*/
            addMemberCommit() {
                console.log('add');
                let obj = {name: this.addName, money: this.addMoney, tel: this.addTel}
                // let obj = {name: 'this.addName', money: 555, tel: '12323'}
                this.addMemberCommitAct(obj).then(resp => {
                    if (resp.Code === 200) {
                        this.addDialogVisible = false
                        this.$message({
                            message: '添加成功',
                            type: 'success',
                            center: true,
                        });
                        if (this.pageType) {
                            this.searchPage();
                        } else {
                            this.pageSelect();
                        }

                        this.operation("添加会员信息")  //发送日志
                    }
                }).catch(err => {
                    console.log(err);
                })
            },
            /*设置行下标属性index*/
            rowClassName({row, rowIndex}) {
                // console.log(row, rowIndex);
                row.index = rowIndex
            },
            /*获取行下标*/
            cellClick(row) {
                console.log(row.index);
                // this.setCheckedRowIndex(row.index)
                this.checkedRowIndex = row.index
                this.fixName = this.oldPageData[row.index].name
                this.fixIdcard = this.oldPageData[this.checkedRowIndex].idCard
                this.fixTel = this.oldPageData[this.checkedRowIndex].tel
                this.fixScore = this.oldPageData[this.checkedRowIndex].score
                this.number = this.oldPageData[this.checkedRowIndex].number
                this.stateSelect=this.oldPageData[this.checkedRowIndex].state
            },
            /*获取修改状态下拉列表值*/
            chooseState(val) {
                this.stateSelect = val;
            },

            /*提交删除数据*/
            deleteMemberCommit() {

                //下方写业务代码
                let obj = {number: this.pageData[this.checkedRowIndex].number,}
                this.deleteMemberCommitAct(obj).then(resp => {
                    if (resp.Code === 200) {
                        this.operation("删除会员信息")  //发送日志

                        this.myDeleteDialogVisible = false
                        this.$message({
                            message: '删除成功',
                            type: 'success',
                            center: true,

                        });
                        if (this.pageType) {
                            this.searchPage();
                        } else {
                            this.pageSelect();
                        }

                    }
                }).catch(err => {
                    console.log(err);
                })
            },
            /*打开充值弹窗*/
            checkAddMoneyBt() {
                this.addMoneyNum = '';
                this.addMoneyDialogVisible = true;
            },
            /*提交充值数据*/
            addMoneyCommit() {
                let obj = {number: this.pageData[this.checkedRowIndex].number, money: this.addMoneyNum}
                this.addMoneyCommitAct(obj).then(resp => {
                    if (resp.Code === 200) {
                        if (this.pageType) {
                            this.searchPage();
                        } else {
                            this.pageSelect();
                        }
                        this.operation("后台会员充值")  //发送日志
                        this.addMoneyDialogVisible = false
                        this.$message({
                            message: '充值成功',
                            type: 'success',
                            center: true,
                        });


                    }
                }).catch(err => {
                    console.log(err);
                })
            },
            checkCombineBt() {
                this.oneTel = ''
                this.twoTel = ''
                this.oneNumberData = []
                this.twoNumberData = []
                this.combineDialogVisible = true;
            },
            /*合并*/
            combineCommit() {
                let obj = {number: this.oneNumberData[0].number, deputyId: this.twoNumberData[0].number}
                this.combineCommitAct(obj).then(resp => {
                    if (resp.Code === 200) {
                        this.operation("合并会员信息")  //发送日志
                        this.enterCombineDialogVisible = false
                        if (this.pageType) {
                            this.searchPage()
                        } else {
                            this.pageSelect()
                        }
                        this.$message({
                            message: '合并成功',
                            type: 'success',
                            center: true,
                        });
                        this.oneTel = this.oneNumberData.tel;
                        this.twoNumberData = [];
                        this.combineSearchPageone()

                    }
                }).catch(err => {
                    console.log(err);
                    this.$message({
                        message: '合并失败',
                        center: true,
                    });
                })
            },
            /*验证是否可以合并*/
            verifyEnterCombine() {
                if (this.oneNumberData.length === 0) {
                    this.$message({
                        message: '请输入主卡信息',
                        center: true
                    })
                } else if (this.oneNumberData[0].state !== 0) {
                    this.$message({
                        message: '非正常状态的会员卡无法合并',
                        center: true
                    })
                } else if (this.twoNumberData.length === 0) {
                    this.$message({
                        message: '请输入副卡信息',
                        center: true
                    })
                } else if (this.twoNumberData[0].state !== 0) {
                    this.$message({
                        message: '非正常状态的会员卡无法合并',
                        center: true
                    })
                } else {
                    this.enterCombineDialogVisible = true;
                }
            },


        },
    }
</script>

<style scoped>

</style>